package com.javacode2018.lesson001.demo15;

import org.junit.Test;

/**
 * @Author: hongsir
 * @Date: 2024/10/11 - 10 - 11 - 9:54
 * @Description: com.javacode2018.lesson001.demo15
 * @Version: 1.0
 */
public class ProxyTest {
    @Test
    public void m1(){
        IService serviceA = new ServiceA();
        IService serviceB = new ServiceB();

        serviceA.m1();
        serviceA.m2();
        serviceA.m3();

        serviceB.m1();
        serviceB.m2();
        serviceB.m3();
    }

    @Test
    public void serviceProxy(){
        ServiceProxy serviceA = new ServiceProxy(new ServiceA());
        ServiceProxy serviceB = new ServiceProxy(new ServiceB());

        serviceA.m1();
        serviceA.m2();
        serviceA.m3();

        serviceB.m1();
        serviceB.m2();
        serviceB.m3();
    }

}
